<template>
  <div class="left-container">
    Left组件
    <button @click="getSongs">点击搜索歌曲</button>
    <div v-for="item in musicList" :key="item.id">{{ item.name }}</div>
  </div>
</template>

<script>

export default {
  data() {
    return {
      musicList: [],
      key: '火影忍者'
    }
  },
  methods: {
    // 搜索歌曲
    async getSongs() {
      // const { data: res } = await axios.get('https://autumnfish.cn/search?keywords=' + this.key)
      const { data: res } = await this.$http.get('/search?keywords=' + this.key)
      this.musicList = res.result.songs
    }
  }
}
</script>

<style lang="less" scoped>
.left-container {
  height: 100px;
  background-color: pink;
}
</style>
